cask "firefox@esr" do
  version "140.5.0"

  language "af" do
    sha256 "aaae3662c6c34345ac241f8431165fc91a28bd9841185bb26d37a7d8465bcc0e"
    "af"
  end
  language "ar" do
    sha256 "8691ebd4ca36d8ee5b8b5ba03e1a520b694e648b568fb9b098247a76854317c7"
    "ar"
  end
  language "be" do
    sha256 "c4ac059479eba30b8da5b8dbc2d601ca7bf5f68597ac26613d7efa1e5f2c0512"
    "be"
  end
  language "bg" do
    sha256 "8c062686a9ec558c6228d7b7e987951161724fecc7b178d53e7faff2a9f9e04d"
    "bg"
  end
  language "bn" do
    sha256 "d0a0a6a15f02f9c9b6dbd71e15a6f6e49908b2040c1e9b31dbfa6f9c3ec4f7fe"
    "bn"
  end
  language "ca" do
    sha256 "c54f44d98763a87e44e2101ca25e6d4282a0c060e231c876ff3454f7254dc1c1"
    "ca"
  end
  language "cs" do
    sha256 "b156cd07688b7bdfe9ec50e747e76e3117370996339c9b6b10d1c30622ac2a47"
    "cs"
  end
  language "de" do
    sha256 "5ea7a6e80dc4e0de41a9ec4f2fa3576298f2bdeb6a0f82de4b0b1e95d1d22302"
    "de"
  end
  language "en-CA" do
    sha256 "1e66eff5620fb4505ed948b4828a6f1aea186863d00953aded8873051b93aba1"
    "en-CA"
  end
  language "en-GB" do
    sha256 "79513d213cbffa4b7af8584e67e3696f293958109ac6371d8fcbb3ec6b03c8e6"
    "en-GB"
  end
  language "en", default: true do
    sha256 "7f256f39f1ec8073d82a9492dc2409c449a93a026a538a63c9ff7436ad13e388"
    "en-US"
  end
  language "eo" do
    sha256 "14ffff61664e9924cbf77e2cdb9e55355e1e410a29567857080334c968a2f0ab"
    "eo"
  end
  language "es-AR" do
    sha256 "c5d3c30c245f95587a69d1956b7ddc2d3d17a5c1c9254e7f9856250dd90cea64"
    "es-AR"
  end
  language "es-CL" do
    sha256 "be0b88cb9d42e069eda2f4cd5937946c931befe6d43e319d8517ac034cdf51da"
    "es-CL"
  end
  language "es-ES" do
    sha256 "4647852cfab1430a89dc6b64fd523cc970161f9f21e2057e555d2288559ea6af"
    "es-ES"
  end
  language "fa" do
    sha256 "496ac58ec3e82fdaa85bd00a40b32446460f753e7b2c8aba2a6b002a33f32328"
    "fa"
  end
  language "ff" do
    sha256 "a952c7898dab93f8995b565bb2e5c9d38fd6d74523230677d711cff38c2f7fbd"
    "ff"
  end
  language "fi" do
    sha256 "1f4f9337d146d952d8ca058d4bfba656b5f062a8f343b90d4430259405907f63"
    "fi"
  end
  language "fr" do
    sha256 "bfa03bc95b0e4ee61a869892bf9afe6fc14e8561bf5d90b8f7c95b32275109c4"
    "fr"
  end
  language "gl" do
    sha256 "84c8feab421dc1e2355fc02d47290ea5459c79548ce91f9005b1239e2b98c142"
    "gl"
  end
  language "gn" do
    sha256 "7dad8f1cceb5604154e28e2e8d718e9c1d298ae481f8548be26defd6acfea450"
    "gn"
  end
  language "gu" do
    sha256 "3078e8c596a3f775eb48553f5accbec29350e4a941765a54492e9bb5aadbfdab"
    "gu-IN"
  end
  language "he" do
    sha256 "8ff96cf31bbe3476fc47a9ec015fa1536f57689d9064a6793a8cbc310674df79"
    "he"
  end
  language "hi" do
    sha256 "15d9940dbdec0261a93eeeb04d01adee53ce2dba27095d9a587684ca5a47e02a"
    "hi-IN"
  end
  language "in" do
    sha256 "15d9940dbdec0261a93eeeb04d01adee53ce2dba27095d9a587684ca5a47e02a"
    "hi-IN"
  end
  language "it" do
    sha256 "f4625cfdf9af57ee9d234354aff83758f0aa091e5d8bd83c80294c2a6b1c291c"
    "it"
  end
  language "ja" do
    sha256 "3462d962f3ae967deb9fe13c498a3de2ed0a555650b870bf3d755efdd72531c6"
    "ja-JP-mac"
  end
  language "ka" do
    sha256 "4ed1044fe0a26fa50122be9c444e487b3eab8c0913fa59de8e1941d3df7ab268"
    "ka"
  end
  language "ko" do
    sha256 "4ae1583d40133e41091e0109b59e39b8469ad16888d0d05608564372e727982d"
    "ko"
  end
  language "mr" do
    sha256 "8363fc311c2b5def4eea65952e49047613299b35612e921fa93cab04fac60e94"
    "mr"
  end
  language "my" do
    sha256 "dbfcedfa0ed27e739b62ab8972034fb34d2ac356fa4199ed807b7d1168e00949"
    "my"
  end
  language "ne" do
    sha256 "b6e288b9fd1ab075a4bd510a2eae9f40f06fc452a0ec7354961266e634cb230e"
    "ne-NP"
  end
  language "nl" do
    sha256 "ec86363f2a6295fb1aa9cb29e28a8bed977cbe2a1dc0ada692f8910c5f9c7321"
    "nl"
  end
  language "pa-IN" do
    sha256 "3685c65c70d9fd4a4930ee9a81e0a6a5f5fd6ceb78d53d19194aa4457c3cb719"
    "pa-IN"
  end
  language "pl" do
    sha256 "de631349cb8121de18c5cea055791fd56a8b4da4e1603ba88cdf0496d8f7b137"
    "pl"
  end
  language "pt-BR" do
    sha256 "9cc83c50e87f4bb44607351670a383460884452ef322a7ba025e46b66470b9eb"
    "pt-BR"
  end
  language "pt" do
    sha256 "6f642003f744822df616373d0e93b5284d0b3ebc0ec90cf8792d8a2d5032cb04"
    "pt-PT"
  end
  language "ru" do
    sha256 "47b2594f9186d13d581443e24932808815dc7bd5789f10e134fb7bb9841f67a1"
    "ru"
  end
  language "si" do
    sha256 "61c4de383cc3142672f0aa102c66e5663dcf190f3970baca3159a44ea23999a8"
    "si"
  end
  language "sq" do
    sha256 "cabecdc655021baebea31539bfcf6df738b1046c972cf56604f9ddfff3d13c58"
    "sq"
  end
  language "sr" do
    sha256 "5ae99b9ffcfda54c398b070910371e80bc6009d21ccafac225dcfa88cdcdb0c6"
    "sr"
  end
  language "sv" do
    sha256 "481ab81d4ff463c47c28339afcb9e46f5e90862f1bac15499688b454d378bdc0"
    "sv-SE"
  end
  language "ta" do
    sha256 "ca9d59656937d753ef7c4279bb20db1854b37c2699d166c003acf84e0cfb89e1"
    "ta"
  end
  language "te" do
    sha256 "f5bdc14d526938d0c5879138cdda90463c65246c230fb7694d1d93a441e978dd"
    "te"
  end
  language "th" do
    sha256 "56cd2bc4a98abf2e0a4a0a69a031e65354cb6f40c3db375e189a8ed1c703b696"
    "th"
  end
  language "tl" do
    sha256 "203e5d728c6a4f11024fa543a5ef1b11de8ffe94cedfcc97a82282a2fcde97e8"
    "tl"
  end
  language "tr" do
    sha256 "c7e3509914da9d2d6a405ca5fffa5fee58e0517a62cf84b62e4c02222ff542bf"
    "tr"
  end
  language "uk" do
    sha256 "143343959d28062aaed4f90f434df6f1f2f216482460dbad2ac8843e9bd6f699"
    "uk"
  end
  language "ur" do
    sha256 "569ce51a8a04dd4609d71a8f8ed597fd11febc044e7b9e5d9435c628e3cbec84"
    "ur"
  end
  language "zh-TW" do
    sha256 "08aaee4ad2b1e451befcd64b8e8f36618daa82cb11bc8cb9cd4985295f31b725"
    "zh-TW"
  end
  language "zh" do
    sha256 "a135fc6dc48bcb9fe7b7cd6f094278180908baad8be9708688713490ce9a038c"
    "zh-CN"
  end

  url "https://download-installer.cdn.mozilla.net/pub/firefox/releases/#{version}esr/mac/#{language}/Firefox%20#{version}esr.dmg",
      verified: "download-installer.cdn.mozilla.net/pub/firefox/releases/"
  name "Mozilla Firefox ESR"
  name "Mozilla Firefox Extended Support Release"
  desc "Web browser"
  homepage "https://www.mozilla.org/en-US/firefox/all/#product-desktop-esr"

  livecheck do
    url "https://product-details.mozilla.org/1.0/firefox_versions.json"
    regex(/v?(\d+(?:\.\d+)+)/i)
    strategy :json do |json, regex|
      match = json["FIREFOX_ESR"]&.match(regex)
      next if match.blank?

      match[1]
    end
  end

  auto_updates true
  conflicts_with cask: [
    "firefox",
    "firefox@beta",
    "firefox@cn",
  ]

  app "Firefox.app"

  uninstall quit:   "org.mozilla.firefox",
            delete: "/Library/Logs/DiagnosticReports/firefox_*"

  zap trash: [
        "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.mozilla.firefox.sfl*",
        "~/Library/Application Support/CrashReporter/firefox_*",
        "~/Library/Application Support/Firefox",
        "~/Library/Caches/Firefox",
        "~/Library/Caches/Mozilla/updates/Applications/Firefox",
        "~/Library/Caches/org.mozilla.crashreporter",
        "~/Library/Caches/org.mozilla.firefox",
        "~/Library/Preferences/org.mozilla.crashreporter.plist",
        "~/Library/Preferences/org.mozilla.firefox.plist",
        "~/Library/Saved Application State/org.mozilla.firefox.savedState",
        "~/Library/WebKit/org.mozilla.firefox",
      ],
      rmdir: [
        "~/Library/Application Support/Mozilla", #  May also contain non-Firefox data
        "~/Library/Caches/Mozilla",
        "~/Library/Caches/Mozilla/updates",
        "~/Library/Caches/Mozilla/updates/Applications",
      ]
end
